package com.zh.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;

@RestController
public class HelloController {

    private static final List<String> hellos = Arrays.asList(
            "Hello World", "你好世界", "こんにちは世界", "Bonjour le monde", "Hola Mundo", "안녕하세요 세계"
    );

    private final Random random = new Random();

    @GetMapping("/hello")
    public Map<String, Object> hello() {
        String message = hellos.get(random.nextInt(hellos.size()));
        return Map.of("code", 1, "msg", "", "data", message);
    }
}

